package pwd.allen.behavior.interpreter;

/**
 * 非终结符表达式类
 *
 * @author 门那粒沙
 * @create 2021-05-23 10:37
 **/
public class NonterminalExpression implements IExpression {

    private IExpression expName;
    private IExpression expAction;

    public NonterminalExpression(IExpression expName, IExpression expAction) {
        this.expName = expName;
        this.expAction = expAction;
    }

    @Override
    public String interpret(String info) {
        String str[] = info.split("@");
        return expName.interpret(str[0]) + "," + expAction.interpret(str[1]);
    }
}
